package com.johnny.myRedis;

import redis.clients.jedis.Jedis;

import java.util.Set;

public class MyRedisTest {
    Jedis  jedis;

    public MyRedisTest(){
        this.jedis = new Jedis("192.168.99.100",6379); //dockerIP地址
        jedis.auth("654321");
        System.out.println(this.jedis.ping());
    }

    public Jedis getJedis() {
        return jedis;
    }

    public static void main(String[] args){
         MyRedisTest t1 = new MyRedisTest();
         Jedis jedis = t1.getJedis();
         jedis.set("k2","v2");
         jedis.set("k3","v3");

         System.out.println(jedis.get("k3"));
         Set<String> sets = jedis.keys("*");
         System.out.println(sets.toString());
    }
}
